package com.ecommerce.dal.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ecommerce.dal.dao.impl.ItemDAO;
import com.ecommerce.dal.dao.impl.ItemHistoryDAO;
import com.ecommerce.dal.entity.ItemHistory;
import com.ecommerce.dal.service.IItemManagementService;

/**
 * for ItemHistory manipulation
 * 
 */
@Service("itemManagementService")
public class ItemManagementService implements IItemManagementService {

	@Autowired
	ItemHistoryDAO itemHistoryDAO;
	@Autowired
	ItemDAO itemDAO;

	//
	// @Override
	// public void setItemDiscount(Long itemID, Double discount) {
	// // TODO Auto-generated method stub
	//
	// }




	@Override
	public void saveItemHistory(ItemHistory itemHistory) {
		itemHistoryDAO.save(itemHistory);

	}

	@Override
	public List<ItemHistory> retrieveItemHistory(long itemId) {
		return itemHistoryDAO.findByItemId(itemId);
	}

	//
	// @Override
	// public void updateItemHistory(ItemHistory itemHistory) {
	// // TODO Auto-generated method stub
	//
	// }

	// @Override
	// public void deleteItemHistory(ItemHistory itemHistory) {
	// // TODO Auto-generated method stub
	//
	// }

	//
	// @Override
	// public void setItemPrice(Long itemId, Double price) {
	// // TODO Auto-generated method stub
	//
	// }

	@Override
	public double retrieveTotalItemPrice(long itemId) {
		return itemHistoryDAO.retrieveTotalItemPrice(itemId);
	}

	// @Override
	// public void update(Item item, ItemHistory itemHistory) {
	// // TODO Auto-generated method stub
	//
	// }

//	@Override
//	public void delete(Item item, ItemHistory itemHistory) {
//		itemHistoryDAO.delete(item, itemHistory);
//
//	}

}
